//
//  WHRootWebViewController.m
//  LvZhongMagicKey
//
//  Created by 邓伟浩 on 2018/5/30.
//  Copyright © 2018年 邓伟浩. All rights reserved.
//

#import "WHRootWebViewController.h"
#import "YYKit.h"

@interface WHRootWebViewController ()

@end

@implementation WHRootWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)updateNavigationItems {
    if (_isShowCloseBtn) {
        if (self.webView.canGoBack) {
            self.navigationController.interactivePopGestureRecognizer.enabled = NO;
            [self addNavigationItemWithImageNames:@[@"icon_menu_back", @"icon_menu_close"] isLeft:YES target:self action:@selector(leftBtnClick:) tags:@[@2000,@2001]];
        } else {
            self.navigationController.interactivePopGestureRecognizer.enabled = YES;
            
            if (kiOS9Later) {
                [self addNavigationItemWithImageNames:@[@"icon_menu_close"] isLeft:YES target:self action:@selector(leftBtnClick:) tags:@[@2001]];
            }
        }
    }
}

- (void)leftBtnClick:(UIButton *)btn {
    switch (btn.tag) {
        case 2000:
            [super backBtnClicked];
            
            break;
        case 2001: {
            if (self.presentingViewController) {
                [self dismissViewControllerAnimated:YES completion:nil];
            } else {
                [self.navigationController popViewControllerAnimated:YES];
            }
        }
            break;
        default:
            break;
    }
}

- (void)dealloc{
    
}

@end
